package se19team1e.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import se19team1e.entity.JobAdvertDTO;
import se19team1e.search.SearchEngine;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;

/**
 * A mock SearchEngine, used for testing.
 * 
 * @author lai shiaw san
 *
 */
public class MockSearchEngine implements SearchEngine<JobAdvertDTO,String> {

    /**
     * A list of job adverts added.
     */
    private final List< JobAdvertDTO > jobAdvertAdded = new ArrayList< JobAdvertDTO >();

    /**
     * A list of job adverts updated.
     */
    private final List< JobAdvertDTO > jobAdvertUpdated = new ArrayList< JobAdvertDTO >();

    /**
     * A list of job adverts removed.
     */
    private final List< JobAdvertDTO > jobAdvertRemoved = new ArrayList< JobAdvertDTO >();

    /* (non-Javadoc)
     * @see se19team1e.search.SearchEngine#refreshIndex()
     */
    @Override
    public void refreshIndex() {
        throw new NotImplementedException();
    }

    /* (non-Javadoc)
     * @see se19team1e.search.SearchEngine#search(java.lang.String, java.util.Map)
     */
    @Override
    public List<JobAdvertDTO> search(String criteria, Map<String, String> filters) {
        throw new NotImplementedException();
    }

    /* (non-Javadoc)
     * @see se19team1e.search.SearchEngine#addToIndex(java.lang.Object)
     */
    @Override
    public void addToIndex(JobAdvertDTO jobAdvert ) {
        this.jobAdvertAdded.add( jobAdvert );
    }

    /* (non-Javadoc)
     * @see se19team1e.search.SearchEngine#updateIndex(java.lang.Object)
     */
    @Override
    public void updateIndex( JobAdvertDTO jobAdvert ) {
        this.jobAdvertUpdated.add( jobAdvert );
    }
    
    /* (non-Javadoc)
     * @see se19team1e.search.SearchEngine#removeFromIndex(java.lang.Object)
     */
    @Override
    public void removeFromIndex( JobAdvertDTO jobAdvert ) {
        this.jobAdvertRemoved.add( jobAdvert );
    }
    
    /**
     * List of job adverts added.
     * @return List of job adverts added.
     */
    public List< JobAdvertDTO > getJobAdvertAdded() {
        return this.jobAdvertAdded;
    }
    
    /**
     * List of job adverts updated.
     * @return List of job adverts updated.
     */
    public List< JobAdvertDTO > getJobAdvertUpdated() {
        return this.jobAdvertUpdated;
    }

    /**
     * List of job adverts removed.
     * @return List of job adverts removed.
     */
    public List< JobAdvertDTO > getJobAdvertRemoved() {
        return this.jobAdvertRemoved;
    }

}
